<%-- 
    Document   : update
    Created on : Oct 9, 2012, 9:32:45 PM
    Author     : Minh Quan
--%>

<%@page import="com.Checker"%>
<%@page import="com.Book"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Update book</title>
    </head>
    <body>
        <%
                    String bookID = request.getParameter("bookIDToUpdate");
                    Book curBook = null;
                    if (bookID != null) {
                        curBook = Checker.getBookInfo(bookID);
                    }

        %>
        <h3>Update Book</h3>
        <form action="centralUnit?action=UpdateBook" >
            <fieldset >
                <legend>Book Details</legend>
                <table>
                    <tr>
                        <td>Book ID</td>
                        <td><input type="text" name="txtID" value=<%= bookID %> readonly ></td>
                    </tr>
                    <tr>
                        <td>Title</td>
                        <td><input type="text" name="txtTitle" value=<%= curBook.getTitle()%> ></td>
                    </tr>
                    <tr>
                        <td>Image</td>
                        <td><input type="text" name="txtImage" value=<%= curBook.getImage()%> ></td>
                    </tr>
                    <tr>
                        <td>Author</td>
                        <td><input type="text" name="txtAuthor" value=<%= curBook.getAuthor()%> ></td>
                    </tr>
                    <tr>
                        <td>Type</td>
                        <td><input type="text" name="txtType" value=<%= curBook.getType()%> ></td>
                    </tr>
                    <tr>
                        <td>Price</td>
                        <td><input type="text" name="txtPrice" value=<%= curBook.getPrice()%> ></td>
                    </tr>
                </table>
            </fieldset>
                    <br>
                    <input type="submit" name="action" value="UpdateBook">
        </form>

    </body>
</html>
